/*
 * @Author: xiaxia
 * @Description: 
 * @Date: 2024-07-01 11:11:51
 * @LastEditTime: 2024-07-02 16:12:49
 * @FilePath: \project\src\api\product\spu\type.ts
 */
export interface ResponseData {
  code: number,
  message: string,
  ok: boolean,
}

// SPU数据类型
export interface SpuValue {
  id?: number|string,
  category3Id: number|string, // 三级分类的id
  tmId: number|string, // 品牌id
  spuName: string, // 名字
  description: string, // 描述
  spuSaleAttrList: null|SpuSaleAttr[], // spu销售属性
  spuImageList: null|SpuImage[], // spu图片
}
export type Records = SpuValue[]
export interface spuResponse extends ResponseData {
  data: {
    records: Records
    total: number,
    size: number,
    current: number,
    pages: number
    searchCount: boolean,
  }
}

// 所有的品牌数据
export interface TradeMark {
  id: number,
  tmName: string,
  logoUrl: string,
}
export interface AllTradeMark extends ResponseData {
  data: TradeMark[]
}

// 所有的销售属性
export interface SaleAttr {
  id: number,
  name: string,
}
export interface SaleAttrResponse extends ResponseData {
  data: SaleAttr[]
}

// spu 图片数据
export interface SpuImage {
  id?: number,
  spuId?: number,
  imgName?: string,
  imgUrl?: string,
  name?: string,
  url?: string,
}
export interface SpuImages extends ResponseData {
  data: SpuImage[]
}

// spu 销售属性
export interface SaleAttrValue {
  id?: number,
  spuId?: number,
  baseSaleAttrId: number|string,
  isChecked?: string,
  saleAttrName?: string,
  saleAttrValueName: string,
}
export type SaleAttrValueList = SaleAttrValue[]
export interface SpuSaleAttr {
  id?: number,
  spuId?: number,
  baseSaleAttrId: number|string,
  saleAttrName: string,
  spuSaleAttrValueList: SaleAttrValueList,
  flag?:boolean,
  inputValue?: string,
}
export interface SpuSaleAttrResponse extends ResponseData {
  data: SpuSaleAttr[]
}



// 新增 SKU 属性
export interface skuAttrValue {
  attrId: number|string, 
  valueId: number|string, 
}
export interface skuSaleAttrValue {
  saleAttrId: number|string,
  saleAttrValueId: number|string,
}
export interface SkuInfo {
  id?: number|string,
  spuId: number|string,
  tmId: number|string,
  category3Id: number|string,
  skuName: string,
  price: number|string,
  weight: string
  skuDesc: string,
  isSale: boolean,
  skuDefaultImg: string,
  skuAttrValueList?: skuAttrValue[],
  skuSaleAttrValueList?: skuSaleAttrValue[],
}

// 已有 spu下售卖的商品sku
export interface skuInfoResponse extends ResponseData {
  data: SkuInfo[]
}